import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SetMealVO, SetMealForm, SetMealQuery } from '@/api/merchants/setMeal/types';

/**
 * 查询套餐列表
 * @param query
 * @returns {*}
 */

export const listSetMeal = (query?: SetMealQuery): AxiosPromise<SetMealVO[]> => {
  return request({
    url: '/merchants/setMeal/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询套餐详细
 * @param setMealId
 */
export const getSetMeal = (setMealId: string | number): AxiosPromise<SetMealVO> => {
  return request({
    url: '/merchants/setMeal/' + setMealId,
    method: 'get'
  });
};

/**
 * 新增套餐
 * @param data
 */
export const addSetMeal = (data: SetMealForm) => {
  return request({
    url: '/merchants/setMeal',
    method: 'post',
    data: data
  });
};

/**
 * 修改套餐
 * @param data
 */
export const updateSetMeal = (data: SetMealForm) => {
  return request({
    url: '/merchants/setMeal',
    method: 'put',
    data: data
  });
};

/**
 * 删除套餐
 * @param setMealId
 */
export const delSetMeal = (setMealId: string | number | Array<string | number>) => {
  return request({
    url: '/merchants/setMeal/' + setMealId,
    method: 'delete'
  });
};
